<?php

if ( $argc > 0 ) {
    $ip = $argv[1];
    $port = $argv[2];
}

require_once 'udper.php';

$udper = new Udper();

$data = 'Hello,World.';
log_trace( sprintf("sending to '%s:%s' : $data ...", $ip, $port, $data) );
$udper->send($data, 10, $ip, $port);
$udper->send($data, 10, $ip, $port);
$udper->send($data, 10, $ip, $port);
$udper->send($data, 10, $ip, $port);
$udper->send($data, 10, $ip, $port);

log_trace( 'recving ...' );
$data = $udper->recv(10, $ip, $port);
if ( empty($data) ) {
    log_trace( 'got nothing' );
    exit( 1 );
}
log_trace( "get from '$ip:$port' : $data" );

log_trace( 'done.' );

?>

